home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’97 / Warrior’s Progress / source code / Source / Libraries / Announcer / Modifier.h < prev    next >
Encoding:
Text File  |  1997-06-28  |  562 b   |  32 lines  |  [TEXT/CWIE]

  1. // Modifier.h
  2.  
  3. #ifndef Modifier_h
  4. #define Modifier_h
  5.  
  6. #ifndef Announcing_h
  7. #include "Announcing.h"
  8. #endif
  9.  
  10. template < class ValueType >
  11. class Modifier
  12.   {
  13.     private:
  14.         Announcing<ValueType>& target;
  15.         
  16.         // not implemented:
  17.             Modifier( const Modifier& )
  18.             void operator=( const Modifier& )
  19.         
  20.     public:
  21.         Modifier( Announcing<ValueType>& theTarget )
  22.           : target( theTarget )
  23.           {}
  24.         
  25.         ~Modifier()                                { target.Announce(); }
  26.         
  27.         ValueType& operator*() const        { return target.value; }
  28.         ValueType *operator->() const        { return &target.value; }
  29.   };
  30.  
  31. #endif
  32.